#pragma once

#include "Thread.h"

namespace Core
{
	template <class T>
	class BackgroundWorker : protected Thread
	{
	private:
		T* m_Object;
		void (T::*m_EntryFunction)();

		void Execute()
		{
			(m_Object->*m_EntryFunction)();
		}

	public:
		void Start(T* p_Object, void (T::*f)())
		{
			m_Object = p_Object;
			m_EntryFunction = f;
			Thread::Start();
		}

		void Exit()
		{
			Thread::Exit();
		}
	};
}
